<?php

//auth
Route::group(['prefix' => '/auth', 'namespace' => "Auth", 'middleware' => ['csrf']], function ()
{
    Route::get('login', 'LoginController@showLoginForm')->name('login');
    Route::post('login', 'LoginController@login');
    Route::get('logout', 'LoginController@logout')->name('logout');
    Route::post('logout', 'LoginController@logout')->name('logout');
});

//
Route::group(['prefix' => '/admin', 'namespace' => "Admin", 'middleware' => ['auth', 'permission']], function ()
{
    Route::resource('/menu/tree', 'MenuController@tree');
    Route::resource('/menu', 'MenuController');
    Route::get('/role/{id}/permission', 'RoleController@permissionEdit');
    Route::post('/role/{id}/permission', 'RoleController@permissionStore');
    Route::resource('/role', 'RoleController');
    Route::resource('/user', 'UserController');
    Route::resource('/permission', 'PermissionController');
    Route::resource('/info', 'InfoController');
    Route::resource('/log', 'LogController');
    Route::resource('/loginLog', 'LoginLogController');

    Route::resource('/', 'HomeController');
});
Route::group(['prefix' => '/', 'namespace' => "Home"], function ()
{

    Route::resource('/', 'IndexController');
    Route::any('/list', 'ProductController@index');
    Route::any('/info/{id}', 'ProductController@info');

    Route::any('/auth/login', 'AuthController@login');
    Route::any('/auth/validate', 'AuthController@ajaxValidate');
    Route::any('/auth/register', 'RegisterController@step1');
    Route::any('/auth/code', 'AuthController@code');
    Route::any('/member', 'MemberController@index');
    Route::any('/job', 'MemberController@job');
    Route::any('/au', 'AuditionController@index');
    Route::any('/au/inv', 'AuditionController@inv');
    Route::any('/au/co', 'AuditionController@collect');
    Route::any('/company', 'CompanyController@index');
});
